package cn.iocoder.yudao.module.vlog.report.dal.mysql;

import cn.iocoder.yudao.framework.business.basic.dao.mapper.CoreMapper;
import cn.iocoder.yudao.framework.business.basic.dao.query.CoreLambdaQueryWrapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.vlog.report.dal.dataobject.VLogReportDO;
import cn.iocoder.yudao.module.vlog.report.vo.VLogReportPageReqVO;
import jakarta.annotation.Nullable;
import org.apache.ibatis.annotations.Mapper;

/**
 * 视频举报 Mapper
 *
 * @author 山野羡民（1032694760@qq.com）
 */
@Mapper
public interface VLogReportMapper extends CoreMapper<VLogReportDO> {

    default PageResult<VLogReportDO> selectPage(@Nullable Long userId, VLogReportPageReqVO reqVO) {
        return selectPage(reqVO, new CoreLambdaQueryWrapper<VLogReportDO>()
                .eqIfPresent(VLogReportDO::getUserId, userId)
                .eqIfPresent(VLogReportDO::getToUserId, reqVO.getToUserId())
                .eqIfPresent(VLogReportDO::getBizType, reqVO.getBizType())
                .eqIfPresent(VLogReportDO::getBizId, reqVO.getBizId())
                .likeIfPresent(VLogReportDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(VLogReportDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VLogReportDO::getId));
    }

}
